#include "BagOfGold.h"

#include "Player.h"

BagOfGold::BagOfGold(int x, int y):
	Pickup(x, y)
{
}


BagOfGold::~BagOfGold()
{
}


bool BagOfGold::isPassable(const GameObject* gameObject) const
{
	return true;
}


void BagOfGold::handleCollision(GameObject* gameObject)
{
	if (gameObject->getType() == Type_Player)
	{
		static_cast<Player*>(gameObject)->addToInventory(Player::InventoryItem_Gold, rand() % 99 + 1);
		destroy();
	}
}


void BagOfGold::drawObject(int row, int col) const
{
	std::vector<drawPoint> points;

	// Draw a mountain of gold!
	points.push_back(drawPoint(col + 0.2, row + 0.4, 0));
	points.push_back(drawPoint(col + 0.5, row + 0.2, 0));
	points.push_back(drawPoint(col + 0.8, row + 0.4, 0));
	points.push_back(drawPoint(col + 1  , row + 1  , 0));
	points.push_back(drawPoint(col + 0  , row + 1  , 0));

	drawInMode(GL_POLYGON, points);
	points.clear();
}